import datetime

MILLI_TO_MICRO=1000
SECONDS_IN_DAY=86400
SECONDS_IN_MINUTE=60
SECONDS_IN_HOUR=3600

class timeStamp(datetime.time):
    def __init__(self, hour, minute, second, millisecond):
        self.time=datetime.time(hour, minute, second, millisecond * MILLI_TO_MICRO)
    
    def __add__(self, value):
        self_hour = self.time.hour
        self_minute = self.time.minute
        self_second = self.time.second
        self_millisecond = self.time.microsecond/MILLI_TO_MICRO
        
        if value.__class__ == int:
            if value > SECONDS_IN_DAY:
                return None
            if (value/SECONDS_IN_HOUR + self_hour) >= 24:
                return None
            
            value_second = value % SECONDS_IN_MINUTE
            value_minute = (value / SECONDS_IN_MINUTE) % 60
            value_hour = (value / SECONDS_IN_HOUR)
            
            self_hour = (value_hour + self_hour + (value_minute + self_minute + (value_second + self_second)/60)/60)
            self_minute = (value_minute + self_minute + (value_second + self_second)/60)
            self_second = (value_second + self_second) % 60
            
            return timeStamp(self_hour, self_minute, self_second, self_millisecond)
        
        else:
            return None 